" markdown

" Ideal column width is 100
autocmd FileType markdown setlocal textwidth=100
autocmd FileType markdown setlocal spell
autocmd FileType markdown setlocal colorcolumn=100

" Make level 1 and level 2 headers
autocmd FileType markdown nnoremap <space>h1 yypVr=kA <!-- {{{1 --><esc>O\pagebreak<cr><esc>j
autocmd FileType markdown nnoremap <space>h2 yypVr-kA <!-- {{{2 --><esc>
autocmd FileType markdown nnoremap <space>h3 I### <esc>
autocmd FileType markdown nnoremap <space>h4 I#### <esc>
autocmd FileType markdown nnoremap <space>h5 I##### <esc>
autocmd FileType markdown nnoremap <space>h6 I###### <esc>

" shortcuts to use build in pandoc
autocmd FileType markdown nnoremap K :PandocToHtml<cr>
autocmd FileType markdown nnoremap <space>K :PandocToPdf<cr>

" auto enter new file header
autocmd BufNewFile *.mkd normal I<!--  -->F!lll"%p
autocmd BufNewFile *.mkd silent! s/ .*\// /
autocmd BufNewFile *.mkd s/\.mkd//
